<include file="Public/header" />
<include file="Public/menu" />

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            首页
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页管理</a></li>
            <li class="active">修改专题广告</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">修改专题广告</h3>

                <div class="box-tools">

                    <div class="btn-group pull-right" style="margin-right: 10px">
                        <a href="/Qgs/special/advert" class="btn btn-sm btn-default"><i class="fa fa-list"></i>&nbsp;广告列表</a>
                    </div>
                </div>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form action="/Qgs/special/advertedit" id="form" method="post" accept-charset="UTF-8" class="form-horizontal" pjax-container="">

                <div class="box-body">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">名称</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="name" value="{$name}" class="form-control" placeholder="广告名称">
                                <input type="hidden" name="id" value="{$id}" class="form-control" placeholder="广告名称">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box-body img-link">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">链接</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="url" value="{$url}" class="form-control" >
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box-body">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">图片</label>
                        <div class="col-sm-6">
                            <input type="file" id="image" data-max-file-count="1" />
                            <input type="hidden" id="image_action"/>
                        </div>
                    </div>
                </div>
                <div for="image" class="form-group 1">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-6" style="margin-left: 16px; color: #da2424">* 建议宽高750px*185px</div>
                </div>
                <div class="box-body">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">排序</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="order" value="{$order}" class="form-control" placeholder="排序">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box-body">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">显示</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                是 <input type="radio"  name="status" value="1">
                                否 <input type="radio" name="status" value="0">
                            </div>
                        </div>
                    </div>
                </div>
                <!--<div class="form-group">-->
                    <!--<label class="col-sm-2 control-label">开始时间</label>-->
                    <!--<div class="col-sm-6">-->
                        <!--<div class="input-group">-->
                            <!--<input class="form-control" type="text" id="start_time" name="start_time" value="{:date('Y-m-d H:i:s',$start_time)}"  />-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div class="form-group">-->
                    <!--<label class="col-sm-2 control-label">结束时间</label>-->
                    <!--<div class="col-sm-6">-->
                        <!--<div class="input-group">-->
                            <!--<input class="form-control" type="text" id="end_time" name="end_time" value="{:date('Y-m-d H:i:s',$end_time)}" />-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <!-- /.box-body -->
                <div class="box-footer">
                    <div class="col-sm-2">

                    </div>
                    <div class="col-sm-6">

                        <div class="btn-group pull-left">
                            <button type="submit" id="submit" class="btn btn-info pull-right">提交</button>
                        </div>
                    </div>

                </div>
                <!-- /.box-footer -->
            </form>
        </div>

    </div></div>

    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer" />
<!--上传插件-->
<link rel="stylesheet" href="/Public/admin/fileinput/fileinput.min.css">
<script src="/Public/admin/fileinput/fileinput.min.js"></script>
<link rel="stylesheet" href="/Public/admin/jedate/jedate.css" />
<script src="/Public/admin/jedate/jedate.js"></script>
<script type="text/javascript" src="/Public/admin/js/admin.yx.discount.js"></script>
<script>
    // 上传图片js
    $("#image").fileinput({
                overwriteInitial: true,
                dropZoneEnabled: false,
                uploadUrl: '/Qgs/upload/index/"',
                language: 'zh',
                showRemove: false,
                maxFileCount: 1,
                browseClass: 'btn btn-primary btn-docup',
                showPreview: true,
                uploadClass: 'btn btn-default btn-docup',
                allowedFileTypes: ["image"],
                browseLabel: "添加图片",
                uploadLabel: "上传图片",
                initialCaption:"{$image}",
            <if condition = "(!empty($image))">
            initialPreview:['<img src="/Uploads/{$image}" class="file-preview-image">']
    </if>
    }).on("fileuploaded", function (event, data, previewId, index) {
        var response = data.response;
        if (data.jqXHR.status == 200) {
            // ajax 成功返回数据写入
            $('.file-preview-frame').eq(index).append("<input class='abc' type='hidden' name='img' value='"+response+"'>");
        }
    });
    $("#image").on('filecleared', function(event) {
        $("#image_action").val(1);
    });
    $('#Continent').change(function () {
        //获取下拉框选中项的index属性值
        var selectIndex = $('#Continent').get(0).selectedIndex;
        if (selectIndex !=0) {
            $('.img-link').css('display','none');
        }else {
            $('.img-link').css('display','block');
        }
    });

    $(function(){
       $('input[name="status"]').val([{$status}]);
//        $('#end_time').blur(function(){
//           var start = $('#start_time').val();
//           var end = $('#end_time').val();
//            if (end < start) {
//                alert('结束时间必须大于开始时间');
//                $('#submit').attr('disabled',true)
//                return false;
//            }
//            $('#submit').attr('disabled',false)
//        });

    });
</script>
